package com.lucy.nepu.module.htopic.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lucy.common.converter.JpaColumnConverter;
import com.lucy.common.core.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "nepu_hor_topic")
@ApiModel(value = "横向课题")
public class HorTopic extends BaseEntity implements Serializable {

    @ApiModelProperty("周期ID")
    @Column(name = "period_id")
    String periodId;


    @ApiModelProperty(value = "横向课题经费",notes = "单位(万)")
    @Column(name = "funds",scale = 2)
    Double funds;

    /**
     * 对应课题ID 对应 nepu_subject_dict 中的 ID
     * 可以使用级联合 多对一 # 暂不使用
     */
    @ApiModelProperty(value = "对应课题类型ID",notes = "")
    @Column(name = "hor_topic_dict_id")
    String horTopicDictId;

    /**
     * 横向课题名称
     */
    @ApiModelProperty(value = "横向课题名称",notes = "")
    @Column(name = "hor_topic_name")
    String horTopicName;

    /**
     * 横向课题类型
     */
    @ApiModelProperty(value = "横向课题类型",notes = "自然科学，社会科学")
    @Column(name = "hor_topic_type")
    String horTopicType;

    /**
     * 横向课题级别
     */
    @ApiModelProperty(value = "横向课题级别",notes = "A1,A2,B1等")
    @Column(name = "hor_topic_level")
    String horTopicLevel;
    /**
     * 横向课题负责人姓名
     */
    @ApiModelProperty(value = "横向课题负责人",notes = "")
    @Column(name = "leader")
    String leader;

    /**
     * 横向课题负责人ID
     */
    @ApiModelProperty(value = "横向课题负责人ID",notes = "")
    @Column(name = "leader_id")
    Long leaderId;

    /**
     * 课题编码
     */
    @ApiModelProperty("课题编码")
    @Column(name = "hor_topic_code")
    String horTopicCode;

    /**
     * 横向课题开始日期
     */
    @ApiModelProperty(value = "课题开始日期",notes = "课题开始日期，如2021/11/16")
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    @Column(name = "start_date")
    Date startDate;

    /**
     * 纵向课题完成日期
     */
    @ApiModelProperty(value = "课题结束日期",notes = "课题结束日期，如2021/11/16")
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    @Column(name = "end_date")
    Date endDate;

    /**
     * 横向课题成员ID列表
     */
    @ApiModelProperty(value = "横向课题成员ID列表",notes = "")
    @Convert(converter = JpaColumnConverter.class)
    @Column(name = "user_id_list")
    List<Long> userIdList;

    /**
     * 分配所得工作量
     */
    @ApiModelProperty(value = "工作量",notes = "")
    @Column(name = "workload",scale = 2)
    Double workload;

    /**
     * 关联文件列表
     */
    @Convert(converter = JpaColumnConverter.class)
    @ApiModelProperty(value = "关联文件ID列表")
    @Column(name = "file_ids")
    List<String> fileIds;

    /**
     * 0. 关闭状态 -- 可以删除
     * 1. 正常状态 -- 可以删除
     * 2. 已经登记工作量 -- 锁定无法操作
     */
    @ApiModelProperty("记录状态")
    @Column(name = "status")
    Integer status;
}
